home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / e_to_l / itgraph / delphi / conninfo.pas < prev    next >
Pascal/Delphi Source File  |  1996-09-15  |  3KB  |  100 lines

  1. unit Conninfo;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  6.   StdCtrls, ExtCtrls, ITGraph, SysUtils, Dialogs;
  7.  
  8. type
  9.   TConnInfoDlg = class(TForm)
  10.     OKBtn: TBitBtn;
  11.     CancelBtn: TBitBtn;
  12.     Bevel1: TBevel;
  13.     Label1: TLabel;
  14.     Label2: TLabel;
  15.     Label3: TLabel;
  16.     ConnLabel: TMemo;
  17.     ConnId: TEdit;
  18.     ConnData: TEdit;
  19.     RemoveBtn: TButton;
  20.     Label4: TLabel;
  21.     ConnectionSource: TEdit;
  22.     Label5: TLabel;
  23.     ConnectionTarget: TEdit;
  24.     Label6: TLabel;
  25.     PanelConnColor: TPanel;
  26.     ColorDialog1: TColorDialog;
  27.     Label7: TLabel;
  28.     ComboArrowHeads: TComboBox;
  29.     Label8: TLabel;
  30.     ComboAlignLabel: TComboBox;
  31.     Label9: TLabel;
  32.     ScrollLineWidth: TScrollBar;
  33.     EditLineWidth: TEdit;
  34.     procedure FormShow(Sender: TObject);
  35.     procedure OKBtnClick(Sender: TObject);
  36.     procedure RemoveBtnClick(Sender: TObject);
  37.     procedure PanelConnColorClick(Sender: TObject);
  38.     procedure ScrollLineWidthChange(Sender: TObject);
  39.   private
  40.     { Private declarations }
  41.   public
  42.     { Public declarations }
  43.     itgTheGraph : ^TITGraph;
  44.   end;
  45.  
  46. var
  47.   ConnInfoDlg: TConnInfoDlg;
  48.  
  49. implementation
  50.  
  51. {$R *.DFM}
  52.  
  53. procedure TConnInfoDlg.FormShow(Sender: TObject);
  54. begin
  55.      ConnectionSource.Text := itgTheGraph^.List(.itgTheGraph^.  ConnectFromIndex.);
  56.      ConnectionTarget.Text := itgTheGraph^.List(.itgTheGraph^.ConnectToIndex.);
  57.      ConnLabel.Text := itgTheGraph^.ConnectionLabel;
  58.      ConnId.Text := IntToStr(itgTheGraph^.ConnectionId);
  59.      ConnData.Text := IntToStr(itgTheGraph^.ConnectionData);
  60.      PanelConnColor.Color := itgTheGraph^.ConnectionColor;
  61.      ComboArrowHeads.ItemIndex := itgTheGraph^.ConnectionArrow;
  62.      ComboAlignLabel.ItemIndex := itgTheGraph^.ConnectionAlign;
  63.      ScrollLineWidth.Position := itgTheGraph^.ConnectionLineWidth;
  64.      EditLineWidth.Text := IntToStr(itgTheGraph^.ConnectionLineWidth);
  65. end;
  66.  
  67. procedure TConnInfoDlg.OKBtnClick(Sender: TObject);
  68. begin
  69.      itgTheGraph^.ConnectionLabel := ConnLabel.Text;
  70.      itgTheGraph^.ConnectionData := StrToInt(ConnData.Text);
  71.      itgTheGraph^.ConnectionColor := PanelConnColor.Color;
  72.      itgTheGraph^.ConnectionArrow := ComboArrowHeads.ItemIndex;
  73.      itgTheGraph^.ConnectionAlign := ComboAlignLabel.ItemIndex;
  74.      itgTheGraph^.ConnectionLineWidth := ScrollLineWidth.Position;
  75. end;
  76.  
  77. procedure TConnInfoDlg.RemoveBtnClick(Sender: TObject);
  78. var
  79.    fromIx, toIx: Integer;
  80. begin
  81.      fromIx := itgTheGraph^.ConnectFromIndex;
  82.      toIx := itgTheGraph^.ConnectToIndex;
  83.      itgTheGraph^.RemoveFrom(.fromIx.) := toIx;
  84.      ConnInfoDlg.Close
  85. end;
  86.  
  87. procedure TConnInfoDlg.PanelConnColorClick(Sender: TObject);
  88. begin
  89.      ColorDialog1.Color := PanelConnColor.Color;
  90.      if ColorDialog1.Execute then
  91.         PanelConnColor.Color := ColorDialog1.Color
  92. end;
  93.  
  94. procedure TConnInfoDlg.ScrollLineWidthChange(Sender: TObject);
  95. begin
  96.      EditLineWidth.Text := IntToStr(ScrollLineWidth.Position)
  97. end;
  98.  
  99. end.
  100.